<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function sum(a,b){
            console.log(this);
            return a + b
        }
        let obj = {name:'jack'}
        const res = sum.call(obj,100,200)  //this指向obj
        console.log(res);

        let p = document.querySelector('p') //this指向p
        const res2 = sum.call(p,100,200)

        const res3 = sum.call(123,45,63)  //this指向Number对象
        console.log(res3);

        const res4 = sum.call(undefined,100,200) //this指向window
        console.log(res4);
        
        const res5 = sum.call(window,100,200) //this指向window
        console.log(res5);
    </script>
</body>
</html>